package com.sbcb.properties.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
@ConfigurationProperties(prefix = "database")
public class DatabaseSource {
    private String url;
    private String userName;
    private String password;
    private String remark;
    private List<ServerInfo> serverInfoList = new ArrayList<>();
    private Map<String,String> mapInfo = new HashMap<>();
    @Value("${valueConfigure}")
    private String valueConfiguredItem;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public List<ServerInfo> getServerInfoList() {
        return serverInfoList;
    }

    public void setServerInfoList(List<ServerInfo> serverInfoList) {
        this.serverInfoList = serverInfoList;
    }

    public Map<String, String> getMapInfo() {
        return mapInfo;
    }

    public void setMapInfo(Map<String, String> mapInfo) {
        this.mapInfo = mapInfo;
    }

    @Override
    public String toString() {
        return "DatabaseSource{" +
                "url='" + url + '\'' +
                ", userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                ", remark='" + remark + '\'' +
                ", serverInfoList=" + serverInfoList +
                ", mapInfo=" + mapInfo +
                ", valueConfiguredItem='" + valueConfiguredItem + '\'' +
                '}';
    }
}
